<template>
    <div>
      <h1>新增与流失</h1>
      <div>
        <el-card class="member-count-card">
          <div class="count-value">{{ memberCount }}</div>
          <div class="count-label">会员总数</div>
        </el-card>
      </div>
      <div ref="chart" style="width: 100%; height: 400px;"></div>
    </div>
  </template>
  
  <script setup>
  import { ref, onMounted } from 'vue';
  import { getMemberCount } from '@/api/member';  // 假设你的 API 路径正确
  
  
  const memberCount = ref(0);
  
  onMounted(async () => {
    try {
      const response = await getMemberCount();
      memberCount.value = response.data.count; // 假设返回的数据结构是 { count: 会员总数 }
    } catch (error) {
      console.error('获取会员总数失败:', error);
    }
  });
  </script>
  
  <style scoped>
  .member-count-card {
    width: 200px;
    margin: 20px auto;
    text-align: center;
    background-color: #409eff;
    color: white;
    padding: 20px;
    font-size: 2em;
    border-radius: 8px;
  }
  
  .count-value {
    font-size: 2.5em;
    font-weight: bold;
  }
  
  .count-label {
    margin-top: 10px;
    font-size: 1.2em;
  }
  </style>
  